﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Avalonia.Controls;

namespace AvalonAdmin.Utils.UtilCopy
{
    /// <summary>
    /// 实现基于 TopLevel 的服务
    /// </summary>
    public class AvaloniaClipboardService : IClipboardService
    {
        private readonly TopLevel _topLevel;

        public AvaloniaClipboardService(TopLevel topLevel)
        {
            _topLevel = topLevel;
        }

        public Task CopyTextAsync(string text)
        {
            return _topLevel.Clipboard?.SetTextAsync(text) ?? Task.CompletedTask;
        }
    }

}
